//--------boucle anim---------------
function ChteuMeulEu(){
with (this) {
framerate+=(N==0)
img.top=y+(p1+=p2++)-dH
img.left=x+(x1+=x2)-dL
if(y+p1>ny){
p1=0;p2=-Math.random()*12-2
x1=0;x2=Math.random()*6-3
y=ym;x=xm
}
setTimeout(sto,0)
}
}
//------------------------------
function resize() {
nx=document.body.offsetWidth
ny=document.body.offsetHeight
}
//---- ajout de p閜ites-----
function creation() {
img=document.all.tags("IMG")
object[no] = new CObj(no++,img[pi++],no,1+Math.random()*2,1+Math.random()*10)
if(pi>img.lenght || img[pi].className!="img" )pi=0
}
//---- def object---------------------
function CObj(N,obj,k,pr,pk){
document.body.insertAdjacentHTML("BeforeEnd"," ")
//----def des attributs
img = document.all.tags("img")
this.img = img[img.length-1]
this.dL=this.img.width/2
this.dH=this.img.height/2
this.img=this.img.style
this.N = N
this.sto="object["+N+"].ChteuMeulEu()"
this.x=xm
this.y=ym
//--- param鑤res chute----
this.p1=9999
this.p2=0
this.x1=0
this.x2=0
//-----def des m閠hodes---
this.ChteuMeulEu = ChteuMeulEu
//----c parti-----
setTimeout(this.sto,0)
}
//---- adaptation du nombre d'objets--------
function cptf(){
t.innerHTML=(framerate*2)+" fps - "+no+" obj"
if(framerate*2>fps)for(i=0;i<3;i++)creation()
framerate=0
}
//--- la vrai fonction zYva (m閒iez vous des contrefa鏾ns)----
function zyva(){
////////r間lage de la fluidit丒du script///////
fps=25
///////////////
resize()
document.body.style.cursor="hand"
xm=nx/2;ym=ny/2
document.onmousemove=moumove
for(i=0;i<5;i++)creation()
setInterval("cptf()",500);//
}
//------matraque de la souris----------
function moumove(){
xm=window.event.clientX
ym=window.event.clientY+document.body.scrollTop
}
|
|
|
| | | |